package com.hackordie.commons.game.player;

import java.util.ArrayList;
import java.util.List;

import com.hackordie.commons.hardware.components.AComponent;
import com.hackordie.commons.hardware.components.NetworkCard;
import com.hackordie.commons.hardware.computer.IComputer;
import com.hackordie.constants.EComponentsType;

public class Player {

    public String name;
    public IComputer pc;

    

    public Player(String name, IComputer pc) {
        this.name = name;
        this.pc = pc;

        // el primer pc al que estara conectado es al suyo propio
        pc.getOperativeSystem().inititateConnectedTo(pc);
    }

    // getters
    public String getName() {
        return name;
    }

    public IComputer getPc() {
        return pc;
    }

    public List<String> getMyAvailablesIpsConnections() {

        List<String> availableIps = new ArrayList<String>();

        List<AComponent> networkCard = pc
                .getComponentByType(EComponentsType.NetworkCard);

        for (int i = 0; i < networkCard.size(); i++) {
            availableIps.add(((NetworkCard) networkCard.get(i))
                    .getConnectedToIp());
        }

        return availableIps;
    }

   

}
